package com.guomei.mapper.curse;

import org.apache.ibatis.annotations.Param;

import com.guomei.bean.exam.domain.ExamEnroll;

import java.util.List;

/**
 * 考试报名Mapper接口
 */
public interface ExamEnrollMapper {
    
    /**
     * 根据ID查询
     */
    ExamEnroll selectById(@Param("id") Long id);
    
    /**
     * 查询所有
     */
    List<ExamEnroll> selectAll();
    
    /**
     * 条件查询
     */
    List<ExamEnroll> selectByCondition(ExamEnroll examEnroll);
    
    /**
     * 新增
     */
    int insert(ExamEnroll examEnroll);
    
    /**
     * 批量新增
     */
    int batchInsert(List<ExamEnroll> examEnrolls);
    
    /**
     * 根据ID更新
     */
    int updateById(ExamEnroll examEnroll);
    
    /**
     * 根据ID删除
     */
    int deleteById(@Param("id") Long id);
    
    /**
     * 批量删除
     */
    int batchDelete(@Param("ids") List<Long> ids);
    
    /**
     * 根据考试ID查询
     */
    List<ExamEnroll> selectByExamId(@Param("examId") Long examId);
    
    /**
     * 根据用户ID查询
     */
    List<ExamEnroll> selectByUserId(@Param("userId") Long userId);
    
    /**
     * 根据考试ID和用户ID查询
     */
    ExamEnroll selectByExamIdAndUserId(@Param("examId") Long examId, @Param("userId") Long userId);
    
    /**
     * 根据考试ID和身份证号查询
     */
    ExamEnroll selectByExamIdAndIdCard(@Param("examId") Long examId, @Param("idCard") String idCard);
    
    /**
     * 根据考试ID和手机号查询
     */
    ExamEnroll selectByExamIdAndPhone(@Param("examId") Long examId, @Param("phone") String phone);
    
    /**
     * 根据订单编号查询
     */
    ExamEnroll selectByOrderNo(@Param("orderNo") String orderNo);
    
    /**
     * 根据考试ID删除
     */
    int deleteByExamId(@Param("examId") Long examId);
    
    /**
     * 根据用户ID删除
     */
    int deleteByUserId(@Param("userId") Long userId);
    
    /**
     * 统计用户报名次数
     */
    int countByUserIdAndExamId(@Param("userId") Long userId, @Param("examId") Long examId);
    
    /**
     * 统计考试报名人数
     */
    int countByExamId(@Param("examId") Long examId);
}
